<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<%@ include file="/common/hallimport.jsp" %>
<link href="${ctx}/css/hall.css" rel="stylesheet">
<link href="${ctx}/css/web_style.css" rel="stylesheet">
<script src="${ctx}/js/web/tab.js"></script>
<title>竞价标的-采购大厅</title>
</head>
<body>
<%@ include file="/common/halltop_caigou.jsp" %>
<div  id="content" class="fixedw">

  <div class="tzgg user_tzgg">
    <form	id="content_notice_form">
  		<input type="hidden" name="methodKey" value="contentList" >
  		<input type="hidden" name="contentType" value="采购公告" >
  		<input type="hidden" name="tab" value="div" >
  	</form>
    <h6 class="tzgg_title"><img src="${ctx}/images/web/icon05.png" /> 采购公告</h6>
    <marquee width="780"><ul id="content_notice_div"></ul></marquee>
	    <script type="text/template" id="content_notice_div_html">
		<? for ( var i = 0; i < rows.length; i++) {?>
		<li><a href="/admin/hall/content/<?=rows[i].infoId?>"><?=rows[i].title?></a></li>
		<?}?> 
		</script>
    <div class="user"> 当前用户：${loginUser.userEname} <a href="javascript:logout()"><img src="${ctx}/images/web/icon_tc.png"  /></a> </div>
    <p class="more"><a href="${ctx}/sendPage/hall/caigou-contents">查看更多</a></p>
  </div>
  <div class="main">
  <div class="left">
  <h5 class="con_title"><span></span> 采购标的 </h5>
	<!-- 搜索开始 -->
     <div class="searchForm">
     <form id="runningList_form">
		<input type="hidden" name="page"  value="1">
		<input type="hidden" name="rows"  value="9" id="rows">
		<input type="hidden" name="direction"  value="F">
		<input type="hidden" name="methodKey"  value="itemList">
		<input type="hidden" name="tag"  value="div" id="tag">
		<select name="itemStatus">
		<option value="2">所有状态</option>
		<option value="B">自由报价期</option>
		<option value="C">限时报价期</option>
		</select>
		<input type="text" name="itemName"  value=""  tip="标的名称" placeholder="标的名称" /><a class="searchbtn" iconCls="icon-search" onclick="runningListSearch();">查询</a>
	</form>
	<ul class="fltab fr" id="fltab">
       <li class="cur"></li>
       <li></li>
    </ul>
	</div>
	<!-- 搜索结束 -->
	<div class="flcon" id="flcon">
	
<ul class="img_list" id="runningList_div">
      
     </ul>
     <script type="text/template" id="runningList_div_html">
	 <? for ( var i = 0; i < rows.length; i++) {?>
	   <li>
		<input type=hidden name=ids value=<?=rows[i].itemId?> >
      	<a onclick="gotohall('<?=rows[i].itemId?>');"><img src="<?=strUtil.doNull(rows[i].picUrl,'${ctx}/images/def.jpg')?>"/></a>
      	<div class="img_list_txt" >
	      	<h3><a title="<?=rows[i].itemName?>" onclick="gotohall('<?=rows[i].itemId?>');"><?=strUtil.subStr(rows[i].itemName,15)?></a></h3>
	      	<div class="curprice">当前价：<span id=value_<?=rows[i].itemId?>></span>万 （<em id=num_<?=rows[i].itemId?>></em>次报价）</div>
	      	<div class="firstPrice">起始价：<span><?=rows[i].firstValuePre?></span>万</div>  
	        <div class="time">距结束：<span id=sptime_<?=rows[i].itemId?>>2天12时3分34秒</span></div>
	        <div class="img_status" id=status_<?=rows[i].itemId?>></div>
	     </div>
      </li>	
     <?}?>
	 </script>
     <ul style="display:none">
	 <table id="runningList_table" class="tb_list" cellspacing="1" cellpadding="0">
		<tr class='active' id="title2" >
			<th width='25%'>标的名称</th>
			<th width='9%'>竞价方式</th>
			<th width='8%'>起始价格</th>
			<th width='8%'>当前价格</th>	
			<th width='8%'>报价次数</th>
			<th width='8%'>最高报价人</th>
			<th width='10%'>竞价状态</th>
			<th width='14%'>剩余时间</th>		
		</tr>
	</table>
	</ul>
	</div>
	<div id="runningList_page" class="web_pages"></div>
	<script type="text/template" id="runningList_table_html">
	<? for ( var i = 0; i < rows.length; i++) {?>
		<tr id=item_<?=rows[i].itemId?>>
			<td class="td_left pl5px">
				<input type=hidden name=ids value=<?=rows[i].itemId?> >
				<a onclick="gotohall('<?=rows[i].itemId?>');"><?=rows[i].itemName?></a>
			</td>
			<td><?=bidModeText(rows[i].bidMode)?></td>
			<td class="td_right"><?=rows[i].firstValuePre?></td>
			<td class="td_right" id=value_<?=rows[i].itemId?>>------</td>
			<td id=num_<?=rows[i].itemId?>>------</td>
			<td id=user_<?=rows[i].itemId?>>------</td>
			<td id=status_<?=rows[i].itemId?>>------</td>
			<td id=sptime_<?=rows[i].itemId?>>------</td>
		</tr>
	<?}?>  		
	</script>
</div>
<div class="right">
<h5 class="con_title"><span></span> 最新采购活动</h5>
	<form id="sessionList_form">
		<input type="hidden" name="page"  value="1">
		<input type="hidden" name="rows"  value="8">
		<input type="hidden" name="status"  value="2">
		<input type="hidden" name="direction"  value="F">
		<input type="hidden" name="methodKey"  value="sessionList">
		<input type="hidden" name="tag"  value="div">
	</form>
	<div class="tj_box" id="sessionList_div"></div>
       <script type="text/template" id="sessionList_div_html">
	       <? for ( var i = 0; i < rows.length; i++) {?>
			  <dl>
                <dt><a href="#"><img src="<?=strUtil.doNull(rows[i].picUrl,'${ctx}/images/def.jpg')?>"/></a></dt>
				<dd>
				<h5><a href="${ctx}/admin/hall/session/<?=rows[i].sessionId?>"><?=rows[i].sessionName?></a></h5>
				<p>当前状态：<span><?=sessionStatusText(rows[i].status)?></span></p>
          		<p>开始时间：<span class="time"><?=rows[i].openTime?></span></p>
                </dd>
			  </dl>
		  <?}?> 
	   </script>
	   <div class="r_more"><a href="/sendPage/hall/sessionList_caigou">查看更多活动>></a></div>
   </div>
  </div>
</div>
<%@ include file="/common/hallbottom.jsp" %>
</body>
</html>

<script>
var itermIds = "";
//打开查看页面
function gotohall(itemId){
	//alert(sessionId);
	window.location.href= ctx+spaceDomain+"hall/item/"+itemId;
}

//查询提交
function runningListSearch(){
	searchSubmit("hall","runningList");
}
//查询提交
function sessionListSearch(){
	searchSubmit("session","sessionList");
}

function getIds(){
	var itermIds = "";
	$("input[name='ids']").each(function(){
		itermIds += $(this).val()+",";
	});	
	return itermIds;
}

function myLoad(){
	var itermIds =getIds(); 
	$.ajax({
		   type:'get',
		   url:ctx+spaceDomain+'hall/cacheList',
		   data:{ids:itermIds},
		   dataType:'json',
		   success: function(myData){
			   //alert(myData.total);
			   if(myData.total>0){
			     myData.rows.forEach(function(e){
			    	 $("#value_"+e.itemId).html(e.lastValue) ;
			    	 $("#num_"+e.itemId).html(e.bidTimes) ;
			    	 $("#user_"+e.itemId).html(e.userName) ;
			    	 $("#status_"+e.itemId).html(itemStatusTxt(e.status)) ;
			    	 //alert(1111);
				     $("#sptime_"+e.itemId).html(spareTxt(e.spareTime)) ;
			    	 //alert(1111);
				 });  
			   }
		  }
	});	
}

//初始化加载
$(function(){
	//加载分页列表
	runningListSearch();
	sessionListSearch();
	//myLoad();
	setInterval(myLoad,3000);
	tabcon2("fltab","flcon");	
	
	//加载所有交易公告
	searchSubmit("hall","content_notice");
});

</script>

